package com.leyou.item.mapper;

import com.leyou.common.mapper.BaseMapper;
import com.leyou.item.pojo.Sku;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * Created by IntelliJ IDEA.
 *
 * @author: wangzibeng
 * Date: 2019/5/5 0005
 * Time: 20:00
 */

@Repository
public interface SkuMapper extends BaseMapper<Sku> {
    /**
     * 减库存
     *
     * @param stock 库存
     * @param id    skuId
     * @return 更新条数
     */
    @Update("update tb_sku set stock = stock - #{stock} where id = #{id}")
    int minusStock(@Param("stock") Integer stock, @Param("id") Long id);
}
